package com.zxl.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.zxl.dao.IEmpDao;
import com.zxl.entity.Emp;
import com.zxl.service.IEmpService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

/**
 * @packageName com.zxl.service.impl
 * @ClassName
 * @Author zxl
 * @Description //TODO
 * @date
 **/
@Service("empService")
@Transactional
public class EmpServiceImpl implements IEmpService {

    @Resource
    private IEmpDao empDao;

    @Transactional(readOnly = true)
    @Override
    public PageInfo<Emp> findAll(Integer pageIndex, Integer pageSize) {
        PageHelper.startPage(pageIndex, pageSize);
        List<Emp> all = empDao.findAll();
        return new PageInfo<>(all);
    }
}
